// eslint-disable-next-line
import { UserLayout, BasicLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '专利流程管理' },
    redirect: '/dashboard/workplace',
    children: [
      // dashboard
      {
        path: '/dashboard',
        name: 'dashboard',
        redirect: '/dashboard/workplace',
        component: RouteView,
        meta: { title: '工作总览' },
        children: [
          {
            path: '/dashboard/workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace20211122'),
            meta: { title: '专利工作台' }
          }
        ]
      },
      {
        path: '/patent/common-business',
        name: 'patent',
        redirect: '/patent/common-business/receive',
        component: RouteView,
        meta: { title: '专利流程' },
        children: [
          {
            path: '/patent/common-business/receive',
            name: 'BusinessReceive',
            component: () => import('@/views/patent-process/BusinessReceive'),
            meta: { title: '业务领取' }
          },
          {
            path: '/process/common-business/list',
            name: 'BusinessList',
            component: () => import('@/views/patent-process/BusinessList'),
            meta: { title: '材料整理' }
          },
          {
            path: '/process/common-business/detail/:id(\\d+)',
            name: 'BusinessEdit',
            component: () => import('@/views/patent-process/BusinessEdit'),
            meta: { title: '案件编辑' },
            hidden: true
          },
          {
            path: '/process/common-business/government',
            name: 'Government',
            component: () => import('@/views/patent-process/Government'),
            meta: { title: '提交官方' }
          },
          {
            path: '/process/common-business/information',
            name: 'Information',
            component: () => import('@/views/patent-process/Information'),
            meta: { title: '信息采集' }
          }
        ]
      },
      {
        path: '/patent/task',
        name: 'task',
        redirect: '/patent/task/list',
        component: RouteView,
        meta: { title: '专利案件' },
        children: [
          {
            path: '/patent/task/list',
            name: 'TaskList',
            component: () => import('@/views/patent-process/TaskList'),
            meta: { title: '案件列表' }
          },
          {
            path: '/patent/task/create',
            name: 'TaskCreate',
            component: () => import('@/views/patent-process/TaskCreate'),
            meta: { title: '创建案件' },
            hidden: true
          },
          {
            path: '/patent/task/detail/:id(\\d+)',
            name: 'TaskEdit',
            component: () => import('@/views/patent-process/TaskEdit'),
            meta: { title: '案件编辑' },
            hidden: true
          }
        ]
      },
      {
        path: '/process',
        name: 'process',
        redirect: '/process/patent/state',
        component: RouteView,
        meta: { title: '数据统计' },
        children: [
          {
            path: '/process/patent/state',
            name: 'PatentStats',
            component: () => import('@/views/stats/PatentStats'),
            meta: { title: '专利统计' }
          }
        ]
      },
      {
        path: '/business',
        name: 'business',
        redirect: '/patent/businesses/edit',
        component: RouteView,
        meta: { title: '业务维护' },
        children: [
          {
            path: '/patent/businesses/edit',
            name: 'BusinessesEdit',
            component: () => import('@/views/common-business/PatentBusiness'),
            meta: { title: '业务管理' }
          }
        ]
      },
      // {
      //   path: '/resource',
      //   name: 'resource',
      //   redirect: '/resource/list',
      //   component: RouteView,
      //   meta: { title: '商标库管理' },
      //   children: [
      //     {
      //       path: '/resource/list',
      //       name: 'ResourceList',
      //       component: () => import('@/views/common-resource/ResourceList'),
      //       meta: { title: '商标库列表' }
      //     },
      //     {
      //       path: '/resource/detail',
      //       name: 'ResourceDetail',
      //       component: () => import('@/views/common-resource/ResourceDetail'),
      //       hidden: true,
      //       meta: { title: '商标详情' }
      //     },
      //     {
      //       path: '/resource/order-list',
      //       name: 'OrderList',
      //       component: () => import('@/views/common-resource/OrderList'),
      //       meta: { title: '订单列表' }
      //     },
      //     {
      //       path: '/resource/order-detail',
      //       name: 'OrderDetail',
      //       component: () => import('@/views/common-resource/OrderDetail'),
      //       hidden: true,
      //       meta: { title: '订单详情' }
      //     },
      //     {
      //       path: '/resource/add',
      //       name: 'AddResource',
      //       component: () => import('@/views/common-resource/AddResource'),
      //       hidden: true,
      //       meta: { title: '新增商标信息' }
      //     }
      //   ]
      // },
      {
        path: '/other',
        name: 'other',
        redirect: '/other',
        component: RouteView,
        meta: { title: '其他管理' },
        children: [
          {
            path: '/other/change',
            name: 'ChangePassword',
            component: () => import('@/views/other/ChangePassword'),
            meta: { title: '修改密码' }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/404')
  }
]
